﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMS.PizzaDecoratorDemo
{
    public abstract class RateDiscount : PizzaDecorator
    {
        public RateDiscount(IPizza pizza)
            : base(pizza)
        { }

        public override double GetPrice()
        {
            double price = _pizza.GetPrice() * (1 - _baseValue);    // size doesn't apply
            return (price > 1d ? price : 1d); // no discount can drop the price below a buck
        }

        public override string GetDescription()
        {
            return String.Format("{0} with {1} discount", _pizza.GetDescription(), _name);
        }
    }
}
